home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / batchlrn.arc / BATHLP.PRN < prev    next >
Encoding:
Text File  |  1991-06-17  |  68.6 KB  |  1,003 lines

  1.     |----------------------------HELP for HLP-----------------------------|
  2.     | use:BATHLP <DOS cmd> brings Help or reports no help is available.   |
  3.     | how:Type "BATHLP <DOS cmd>"to get help for commands MARKED "h" BELOW|
  4.     |  b AUTO-1.HLP   |  * BATHLP.HLP  |  h IF.HLP      |  h PAUSE.HLP    |
  5.     |  b AUTO-2.HLP   |   *this file   |  h IFEXIST.HLP |  h REM.HLP      |
  6.     |  b AUTO-3.HLP   |  h ECHO.HLP    |  b INTRO-1.HLP |  h SHIFT.HLP    |
  7.     |  b BATDO-1.HLP  |  h EDLIN.HLP   |  b INTRO-2.HLP |  h SORT.HLP     |
  8.     |  b BATDO-2.HLP  |  h FIND.HLP    |  b INTRO-3.HLP |  h STOPBAT.HLP  |
  9.     |  b BATDO-3.HLP  |  h FOR.HLP     |  b INTRO-4.HLP |  h VAR.HLP      |
  10.     |  b BATDO-4.HLP  |  h FORINDO.HLP |  h MORE.HLP    ||  >THIRTY .HLP  |
  11.     |  b BATDO-5.HLP  |  h GOTO.HLP    |  h PARAM.HLP   ||  >FILES TOTAL  |
  12.     |      LEGEND:  h=.HLP file  !=1/line descr.   b=run by BATCHLRN      |
  13.     | N-O-T-E: For a "quickie" SHORTENED listing type: "QWIKBAT"!!  For a |
  14.     | printed version (To Print ALL SCREENS) Type:"PRINT BATHLP.PRN"      |
  15.     |    WHEN PRINTING >do not< FORGET TO TYPE: PERFSKIP 6  >f-i-r-s-t<   |
  16.     |---------------T  I   M   E   M   A   S   T   E   R------------------|
  17. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  18. |command: ECHO                                                        |
  19. |use: The batch command ECHO lets you choose whether or not to have   |
  20. | the commands in your batch file displayed on the CRT screen as they |
  21. | are performed. ECHO is also used for message display (no commands   |
  22. | are shown). SEE NOTES SECTION BELOW.                                |
  23. |                                      |
  24. |how: Type: ECHO ON    O-R ECHO OFF [for message sequencing]          |
  25. |                                                                     |
  26. |examples: REFER TO ANY TIMEMASTER .BAT FILES ON THIS DISK            |
  27. |                                                                     |
  28. |notes: Commands in a batch file are normally displayed as they are   |
  29. | performed by your computer. If you enter ECHO OFF into a batch file |
  30. | the commands are not displayed when they are performed. Command dis-|
  31. | play while a batch processing file is operating can be distracting. |
  32. | If you display the commands have a good reason for it!              |
  33. |     A little known (useless?) feature is to type: ECHO <ret> at the |
  34. | prompt, which displays current status of ECHO. If you type ECHO OFF |
  35. | <ret> the prompt will disappear. Type:ECHO ON to restore!           |
  36. |     If ECHO is set to OFF,you can use ECHO <your message>to display |
  37. | text on screen. You can use this ONLY in a batch processing file.   |
  38. | ECHO sends a message to the CRT screen. It helps organize and  ex-  |
  39. | plain on the screen when a batch file executes. Normally, all batch |
  40. | file commands would show on the screen as the file performs. To pre-|
  41. | vent this echoing type:  ECHO OFF at the beginning. In particularly |
  42. | long batch files you may have to do this after several or all of the|
  43. | message echoeing sequences. This becomes especially true when you   |
  44. | are commanding the display of multiple page ascii text files or     |
  45. | when showing long files a page at a time with the DOS MORE command. |
  46. | Your test run of the batch file you create will show you whether or |
  47. | not additional ECHO OFF cmds are necessary. We always"follow-on"the |
  48. | ECHO OFF with a CLS on the next line. This keeps the on-screen co-  |
  49. | mmand distraction to a minimum. If you examine the .BAT & .EX files |
  50. | on this disk you will see the use of ECHO in TIMEMASTER'S efforts.  |
  51. |     When ECHO is OFF none of the actual DOS commands in the batch   |
  52. | file will show on the screen. To display a message put it after tbe |
  53. | command:         ECHO  . . .MY DOG HAS FLEAS!. . .                  |
  54. | (Watch the placement, trying for message centering on the screen).  |
  55. |     As you will see in REM.HLP,that command also displays messages. |
  56. | You will learn,however, that is not the case if ECHO is OFF.        |
  57. |                                                                     |
  58. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  59. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  60. |command:EDLIN (with many, many features)                             |
  61. |                                         |
  62. |---------------------------ONE-LINER HLP-----------------------------|
  63. |                                                                     |
  64. | use:USE OF THIS DOS COMMAND WILL REQUIRE REFERRING TO YOUR MANUAL.* |
  65. |                                                                     |
  66. | EDLIN:Line editor to create,change and display files of ALL kinds.  |
  67. |                                                                     |
  68. | examples:ALL of the batch files on this disk were created using ED- |
  69. | LIN. Should you desire to make changes you can do it the same way!  |
  70. |                                                                     |
  71. | *N-O-T-E:Many DOS Manuals scare newcomers with:"Edlin is not inten- |
  72. |  ded for novice users." BALONEY! Experiment with EDLIN until you    |
  73. |  know HOW TO USE IT! It can become one of your BEST FRIENDS! To the |
  74. |  BATCH PROCESSING PROGRAMMER (we don't care that THEY say"batching" |
  75. |  is NOT programming) it allows you flexibility and fun! We substan- |
  76. |  tially PREFER EDLIN to COPY CON for creating batch processing files|
  77. |  since most of the .BAT files we create are long AND involved. Con- |
  78. |  making it a rule to use EDLIN if the batch file will be more than  |
  79. |  two or three lines.                              |
  80. |                                                                     |
  81. |---------------T  I   M   E   M   A   S   T   E   R------------------|
  82. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  83. |command:FIND                                                         |
  84. |use:FIND searches a file/DIR for a specified word or text string.    |
  85. |                                      |
  86. |how:Type "FIND <insert option> <word or string> <file.ext>".         |
  87. | o-r DIR|FIND "MY"will list all files in curr.dir w/"MY"(caps ONLY!) |
  88. |                                              |
  89. |examples:Look at the BATSEEK.BAT file for an example of the FIND     |
  90. | command used in a batch processing file in conjunction with other   |
  91. | commands and functions. Like any file being used for an example,    |
  92. | however, it will require s-t-u-d-y! Print the file out and examine  |
  93. | the hard copy carefully.                                |
  94. |                                              |
  95. |N-O-T-E-S:Options [/C=display ONLY lines with string/word.           |
  96. |                  [/V=display all lines NOT containing word/string]. |
  97. |                  [/N=display ONLY matches (with line numbers).      |
  98. |  You can search several files @ once:FIND "my" file1.ext file2.ext. |
  99. |  will search for "my" in BOTH of those files (ONLY lower case ltrs).|
  100. |  Upper and lower case letters are NOT CONSIDERED A MATCH {If you    |
  101. |  want"FOO" DO NOT type"foo"}. Tip:Type "listing" files in ALL CAPS. |
  102. |  TIMEMASTER has utility files which convert ENTIRE FILES, either to |
  103. |  all caps or all lowercase, by the use of simple commands.          |
  104. |---------------T  I   M   E   M   A   S   T   E   R------------------|
  105. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  106. |command: FOR                                                         |
  107. |use: The FOR command is used to expand the power of a batch file     |
  108. | command or as an interactive (from the keyboard prompt) command     |
  109. |how: In Batch processing type: FOR %%<c>IN<set>DO<command>           |
  110. |     In Interactive processing type: FOR %<c>IN<set>DO<command>      |
  111. |     (Did you say Huh? You demand...and get, a translation...)       |
  112. |translation: %%<c> or %<c> is a variable. <c> can be any character   |
  113. | except 0,1,2,3...,9. This avoids confusion with the %0-%9 batch pa- |
  114. | ramaters. <set> is a list of items separated by spaces and enclosed |
  115. | in parentheses. For example:: (item1 item2 item3...itemN) is a set. |
  116. | The %%<c> variable is set sequentially to each member of the <set>, |
  117. | and then <command> is performed. If a member of <set> is an express-|
  118. | ion involving either * or ?, or both,  then the varible is set to   |
  119. | each matching pattern from the file. In this case, only one such    |
  120. | <item> may be in the set. Any <item> other than the first <item> is |
  121. | ignored.                                   |
  122. |       (We  KNOW this is  DIFFICULT, but  STAY with us!). . .        |
  123. |explanation: The translation is complex,but UNTIL YOU UNDERSTAND IT, |
  124. | SO is the FOR command. For that reason,AFTER you have finished this |
  125. | .HLP file go to FORINDO.HLP which has examples & explanations(They  |
  126. | are NO GOOD, however, unless you understand the overall concept)!   |
  127. |    The FOR command is similar to the "for..next loop" that programm-|
  128. | ers use to repeat a paricular action a given number of times. The   |
  129. | FOR file to compare files on A: & B: drives looks like this:        |
  130. |    FOR %X IN (*.*) DO IF EXIST B:%X ECHO %X IS ON BOTH A:&B:        |
  131. |    |      |        |=the<command>(here, starting on A:drive, the    |
  132. |    |      |          DO sees IF X {which is *.*[any of all the      |
  133. |    |      |          files on A:]} exists on B: the ECHOes the      |
  134. |    |      |          file name {X} as being on "BOTH A:&B:")        |
  135. |    |      |                                                         |
  136. |    |      |=IN<set> the set is *.* or all the files on A:&B:        |
  137. |    |                                                                |
  138. |    |=FOR is seeking the variable %X (it could be any letter)        |
  139. |                                               |
  140. |            (It should be starting to get clearer)                   |
  141. |    What we have displayed is an interactive FOR command string. If  |
  142. | it were in a two-line batch file (for example) the first line would |
  143. | be ECHO OFF to keep command clutter off the screen. ALSO,in a batch |
  144. | file %X would be %%X (this tells DOS this is NOT a marker. It also  |
  145. | leaves one % after multiple parameter processing {seeFORINDO>HLP}). |
  146. |examples: SEE THE FORINDO.HLP FILE FOR EXAMPLES & EXPLANATIONS!      |
  147. |                                                                     |
  148. |notes: Remember, in a batch file, you must use the expression "%%".  |
  149. | If you are in interactive DOS processing mode,only ONE % is needed. |
  150. | You cannot nest FOR commands in DOS like the FOR-NEXT command is    |
  151. | used in GWBASIC. If you try to do this, the message:                |
  152. |                     "FOR cannot be nested"                          |
  153. | appears when you are running your batch program. The program will   |
  154. | not perform as you expected.                                        |
  155. | (SET) is one or more filenames or commands you want %%Varible to    |
  156. | assume while the command is being executed. Use a space between     |
  157. | entries, and pathnames are not allowed. Don't folrget the parenthe- |
  158. | sis around the set. Wildcards may be used within (SET) if you are   |
  159. | using filenames.                                                    |
  160. | Command is the particular DOS command or batch subcommand you want  |
  161. | to have performed. Usually one or more of these commands will       |
  162. | contain the %%Varible in it. If (SET) contains DOS commands, only   |
  163. | %%Varible is used.                                                  |
  164. | In effect, what this subcommand does is cause %%Varible to be an    |
  165. | index into the (SET) for use by command.                            |
  166. |                                                                     |
  167. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  168. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  169. |command: FOR..IN..DO (Actually multiple commands)                    |
  170. |use:FOR..IN..DO string is used to expand the power of a batch file   |
  171. | or as an interactive (from the keyboard prompt) command             |
  172. |                                                                     |
  173. |how: In Batch processing type: FOR %%<c>IN<set>DO<command>           |
  174. |     In Interactive processing type: FOR %<c>IN<set>DO<command>      |
  175. |                                                                     |
  176. |explanation: The FOR command is similar to the "for..next loop" that |
  177. | programmers use to repeat a paricular action a number of times. A   |
  178. | batch file to compare files on A:& B: drives looks like this:       |
  179. |    ECHO OFF        [keeps command clutter of the screen]            |
  180. |    CLS             [we always do this to get ECHO OFF removed]      |
  181. |    FOR %%Y IN (*.*) DO IF EXIST B:%%Y ECHO %%Y IS ON BOTH A:&B:     |
  182. |    |       |        |=the<command>(here, starting on A:drive,the    |
  183. |    |       |         DO sees if X {which is *.*[any of all the      |
  184. |    |       |         files on A:]} exists on B: the ECHOes the      |
  185. |    |       |         file name {X} as being on "BOTH A:&B:")        |
  186. |    |       |                                                        |
  187. |    |       |=IN<set> the set is *.* or all the files on A:&B:       |
  188. |    |                                                                |
  189. |    |=FOR is seeking the variable %X (it could be any letter)        |
  190. |                                                                     |
  191. |                                               |
  192. |examples: FOR %%gf IN(*.ASM)DO MASM %%f;                             |
  193. | FOR %%f IN(BAK ART BUDGT) DO REM %%f                                |
  194. | The "%%" is needed so that after batch parameter (%0-%9) processing |
  195. | is complete, a % remains. If only %f was entered, the DOS batch pa- |
  196. | rameter processor sees the first "%", looks at "f", then decides    |
  197. | that "%f" is a bad parameter reference, and discards the "%f".      |
  198. | The FOR command would never receive this parameter. In a batch      |
  199. | file, you must use the expression "%%".                             |
  200. | Let's see hoe the batch command works... The first line turns       |
  201. | command displat off to clear command clutter. The second line clears|
  202. | the "echo off" messagefrom the screen. The third line is executed   |
  203. | many times as there are files on the disk in a: [the set (*.*)      |
  204. | assures this]. Each of those filenamesare assigned to %%Z in turn   |
  205. | and then checked for presence on drive B: with the EXIST logical    |
  206. | statement. If EXIST is true, then the message at the end of the IF  |
  207. | subcommand si sent to the screen, otherwise nothing is printed and  |
  208. | the next file on driove A: is assigned and checked.                 |
  209. |   FILES on drive A:               FILES on drive B:                 |
  210. |   -----------------               ------------------                |
  211. |     COMMAND.COM                      COMMAND.COM                    |
  212. |     FILE.ONE                         FILE.ONE                       |
  213. |     FILE.TWO                         FILE.LTR                       |
  214. | The batch subcommand we are investigating is:                       |
  215. | FOR %%Z IN (*.*) DO IF EXIST B:%%Z is on both A: and B:             |
  216. | Each filename on A: is substitutedin the IF subcommand and then     |
  217. | executed. To get the same effect you would have to type--           |
  218. | IF EXIST B:COMMAND.COM ECHO COMMAND.COM is on both A: and B:        |
  219. | IF EXIST B:FILE.ONE ECHO FILE.ONE is on both A: and B:              |
  220. | IF EXIST B:FILE.TWO ECHO FILE.TWO is on both A: and B:              |
  221. | In the case of the example above, the first two would have a posi-  |
  222. | tive responseand the last would not print anything. Study it care-  |
  223. | fully before going on.                                              |
  224. |           FILES on drive A:             FILES on drive B:           |
  225. |           -----------------             -----------------           |
  226. |            COMMAND.COM                   COMMAND.COM                |
  227. |            FILE.ONE                      FILE.ONE                   |
  228. |            FILE.TWO                      FILE.LTR                   |
  229. | OK, told you to study the example. Let's see if you remember. What  |
  230. | is the one line batch file command to find and report out all files |
  231. | starting with an "F" on drive A:? [I'll help you a little, you fill |
  232. | in the blanks.]                                                     |
  233. | ___%%Z IN (A:_____) ____ECHO File_____is on drive A:                |
  234. | FOR %%Z IN (A:F*.*) DO ECHO File %%Z is on drive A:                 |
  235. | In this case you see that the A: disk is checked for any file start-|
  236. | ing with the letter "F" and that name is substituted in the varible |
  237. | %%Z. The appropriate message is then printed with the proper file-  |
  238. | name.                                                               |
  239. | This is not an easy concept. Let's now look at using DOS commands   |
  240. | in (Set).                                                           |
  241. |                FOR...IN..DO using DOS Commands                      |
  242. |                ================================                     |
  243. |  The set can contain DOS commands instead of filenames and these    |
  244. | commands will then be executed in sequence (to include running      |
  245. | large programes under the control of the FOR..IN..DO loop).         |
  246. | Let's say you want to sequentially:  Clear the screen               |
  247. |                                      Show the DOS version number    |
  248. |                    then  Show the disk directory with the pause on  |
  249. | You could do all that in a one line batch file with the following   |
  250. | command in it:: FOR %%T IN (CLS VER DIR/P) DO %%T                   |
  251. | When using DOS commands in (SET) ypu must use the space as a de-    |
  252. | limiter and cannot have asterisk (*) or question mark (?) in any    |
  253. | command. Use a colon(:) instead of a space when passing parameters  |
  254. | to programs (i.e. DBASE:FILE INSTEAD OF DBASE FILE)                 |
  255. | It is possible to issue the FOR..IN..DO command at the DOS prompt   |
  256. | by dropping one of the percentage signs (%) an the varible.         |
  257. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  258. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  259. |command: GOTO                                                        |
  260. |use: The GOTO command is a batch file-only command. It is used to    |
  261. | perform a "jump" from the GOTO <label> to the :<label>. After the   |
  262. | :<label> (the SECOND one) the program performs the commands listed. |
  263. | In"computereze"this is described as:the GOTO command directing the  |
  264. | program to perform the command following the item described in the  |
  265. | command modifier (so much for that!).                               |
  266. |                                                                  |
  267. |how:Type: GOTO <LABEL> (in a batch file), THEN type:<LABEL> later on |
  268. | for a series of commands to be performed.                           |
  269. |                                      |
  270. |when:GOTO is used in conjunction with (usually) some IF condition    |
  271. | or to create a loop function.                                       |
  272. |                                       |
  273. |examples: In a condition situation you would have SEVERAL GOTOs. For |
  274. | example, IF %1 exists GOTO label 1 (next line) IF %1 not exist GOTO |
  275. | label#2. Elsewhere in the batch file :label#1 AND :label#2 would    |
  276. | both be present, followed by commands you want performed depending  |
  277. | on whether %1 existed or not. USUALLY you create another jump at the|
  278. | end of each :label command set with GOTO END, with the :END label   |
  279. | wrapping up the batch processing no matter what else occured in the |
  280. | previous portions of the file. SEE sample batch files on this disk! |
  281. |more examples:(To create a GOTO loop): 1) :spot                      |
  282. |          this is what you would       2) REM This is a loop         |
  283. |             program (3 lines)         3) GOTO spot                  |
  284. | That would cause an infinite sequence of messages to be displayed:  |
  285. |  A>REM This is a loop                                               |
  286. |  A>GOTO spot                                                        |
  287. |  A>REM This is a loop                                               |
  288. |  A>GOTO spot                                                        |
  289. |  A>REM This is a loop   . . . . etcetera (on & on til you stop it!) |
  290. |NOTES: If you do not include <label> in the GOTO command, the batch  |
  291. | processing file stops. Any line in a batch file that starts with ":"|
  292. | is treated as a label but otherwise ignored. DOS only recognizes the|
  293. | FIRST EIGHT characters in a label. To stop an endless loop GOTO file|
  294. | use CTRL-BREAK or CTRL C.                                           |
  295. |                                                                     |
  296. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  297. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  298. |command: IF                                                          |
  299. |use: The IF subcommand allows you to direct the decision-making pro- |
  300. | cess in batch processing files (referred to as statement "testing").|
  301. |                                      |
  302. |how: Type: IF <condition> <DOS or batch command> [see*&**NEXT]       |
  303. | **<command> == Any legal DOS command or batch file subcommand       |
  304. | *<condition> == One of three tests that yield a true or false re-   |
  305. | sult:                                      |
  306. |               1. The ERRORLEVEL of a program (see below)            |
  307. |               2. Two strings that are equivalent or the same.       |
  308. |               3. A file that exists in the CURRENT directory.       |
  309. |                                                                     |
  310. |explanation:The IF command tests for true or false. IF true, it per- |
  311. | forms the command. IF NOT true,it skips the command and goes to the |
  312. | NEXT line in the batch processing file. You can "test" SEVERAL lines|
  313. | one after the other, so that if the first line is not true the batch|
  314. | file moves to the next "testing" line. This will continue until no  |
  315. | more tests are left or a TRUE statement directs a command(like GOTO)|
  316. |                                                              |
  317. |examples: Refer to BATSEEK.BAT to see the file testing for the pres- |
  318. | ence of.EXE &.COM files, the GOTO command & the failure to meet the |
  319. | presence of the %1 variable (you JUST typed BATSEEK, nothing else). |
  320. |actual pgm:The following batch file can be used to establish a pass- |
  321. | word for running a program. The batch file is named PASSWRD.BAT and |
  322. | calls up a fictitious program name MY.COM:                          |
  323. |    {NOTE:[fghev xcvw] == our notes  & 0) represents EDLIN line #s}  |
  324. | 1) ECHO OFF       [allows messaging in file w/next cmnd.            |
  325. | 2) CLS            to clear the ECHO OFF from the screen]            |
  326. | 3) IF %1 == ABC GOTO FINE [this is the label][IF TRUE,JUMP occurs]  |
  327. | 4) ECHO BAD PASSWORD--ENDING [msg./appears if NO ABC,then NO JUMP]  |
  328. | 5) GOTO END [ALWAYS end EA.cmnd.sequencing with this cmnd/label]    |
  329. | 6) :FINE  [first label to wh/file JUMP occurs when statement TRUE]  |
  330. | 7) ECHO YOU'RE IDENTIFIED--STARTING CMD.SEQUENCE [msg/1st part:GOOD]|
  331. | 8) MY   [the command portion of the :GOOD command sequence]         |
  332. | 9) GOTO END [remember, end each command sequence this way]          |
  333. |10) :END [the second JUMP label--remember labels direct traffic]     |
  334. |11) ECHO I'VE DONE MY JOB!--RETURNING TO CURRENT DRIVE [end msg.]    |
  335. |elucidation:Look at the response of the computer to various cmds.    |
  336. | First a BAD password. At the prompt type: PASSWRD XYZ [xyz==%1]     |
  337. | The computer tests for TRUE [it's NOT since %1 doesn't == ABC] and  |
  338. | [goes to NEXT line] performs NEXT command, which is to display msg: |
  339. |                       BAD PASSWORD--ENDING                          |
  340. | Now, a GOOD password. At the prompt type: PASSWRD ABC [now,abc==%1] |
  341. | The computer tests for TRUE [it IS since %1 == ABC] and performs the|
  342. | GOTO :FINE command and performs JUMP to label :FINE. P.C.then does  |
  343. | what you told it to do after the label :FINE and performs the comm- |
  344. | and prompt "MY" after acknowledging the passwrod with a message. Af-|
  345. | ter MY performs you are returned to :END and sign off. Note the cmd.|
  346. | MY will not appear because echo is off and you didn't call for ECHO.|
  347. | The :END label displays the final message, but there is no require- |
  348. | ment that additional lines appear after end.                        |
  349. |                                          |
  350. |NOTES: Unlike programming languages, which allow many logical tests  |
  351. | in an IF statement, the batch IF statement is limited to only the   |
  352. | three named above. TO FURTHER EXPLAIN:                              |
  353. |  >Condition 1:ERRORLEVEL is a number that indicates to DOS whether  |
  354. |  the last program run was succesful. A zero (0) indicates a good    |
  355. |  run, anything above zero indicates an error condition (only DOS    |
  356. |  commands BACKUP and RESTORE have an exit code). You probably WILL  |
  357. |  NOT have use for this feature often. There ARE commercial programs |
  358. |  which make extensive use of ERRORLEVEL.These allow PC-User response|
  359. |  and other features like alternate selection via Yes & No or selec- |
  360. |  tion of numbers and/or letters (1,2,3,4 OR a,b,c,d, etc.).         |
  361. |                                                                     |
  362. |  >Condition 2:String comparison is indicated by a double equal sign:|
  363. |                        String1 == String22                          |
  364. | This compares the two strings. It is often used with parameters and |
  365. | markers to check for a particular entry. For example:               |
  366. | IF %1 == 40  typing:"MODE C40" checks parameter one for 40 and, if  |
  367. | if the condition is TRUE [%1 == 40] it changes the display to 40-   |
  368. | columns wide. [SEE batch files on this disk for examples/study them]|
  369. |                                                                     |
  370. |   >Condition 3:The logical test for checking for the existence of a |
  371. | file has as its format: EXIST C:<filename.ext>                      |
  372. | You can use this test to check and see if a file is in C: drive     |
  373. | (as in the example). EXIST B:<filename.ext> might be used to check  |
  374. | to see if B: drive has a DOS disk in the drive. Explore other uses  |
  375. | after examining files on this disk with "EXIST". Note: you cannot   |
  376. | use pathnames for checking on a file's existence.                   |
  377. |                                          |
  378. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  379. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  380. |command: IF EXIST                                                    |
  381. |use: The IF EXIST cmnd. allows CONFIRMATION of a file or condition.  |
  382. |                                                                     |
  383. |how: Type:IF EXIST <filename.ext> or <condition> [then]  <cmnd.> O-R |
  384. |          IF NOT EXIST <same as above>                               |
  385. |                                                                     |
  386. |example: IF EXIST %1 GOTO EXISTS                                     |
  387. |         ECHO     . . . T H E  F I L E  D O E S N ' T  E X I S T !   |
  388. |         :EXISTS                                                     |
  389. |         ECHO  ...%1 IS AN EXISTING FILE IN THE CURRENT DIRECTORY!   |
  390. |                                      |
  391. | If you were to type:"EXIST SWELL.TXT" and it DID NOT EXIST the      |
  392. | statement would be FALSE and the batch file would move to the next  |
  393. | line, displaying: ...THE FILE DOES NOT EXIST! If you typed the same |
  394. | phrase, and the file WAS in the CURRENT directory the statement     |
  395. | would be true and the batch file would JUMP to the label "EXISTS".  |
  396. | It would then display the message: ...SWELL.TXT [that's the %1] IS  |
  397. | AN EXISTING FILE IN THE CURRENT DIRECTORY! Using this basic shell   |
  398. | you can create many IF EXIST batch processing files to make your    |
  399. | work easier. FOR CROSS-REFERENCE SEE THE IF.HLP FILE!               |
  400. |NOTES: When <condition> is TRUE, DOS or batch <command> is performed.|
  401. | When <condition> is NOT TRUE,the <command> is IGNORED and the next  |
  402. | line in the batch processing file is performed.                     |
  403. | The<condition> we are "testing" here, IF EXIST o-r NOT EXIST is ill-|
  404. | illustrated by these two examples:                                  |
  405. |                                                                     |
  406. |         IF EXIST = True if and only if <filename> exists.           |
  407. |                                                                     |
  408. |     IF NOT EXIST = True if and only if <condition> is false.        |
  409. |                                                                     |
  410. |      Another example of IF EXIST (>Condition 3) is as follows:      |
  411. |   >Condition 3:The logical test for checking for the existence of a |
  412. | file has as its format: EXIST C:<filename.ext>                      |
  413. | You can use this test to check and see if a file is in C: drive     |
  414. | (as in the example). EXIST B:<filename.ext> might be used to check  |
  415. | to see if B: drive has a DOS disk in the drive. Explore other uses  |
  416. | after examining files on this disk with "EXIST". Note: you cannot   |
  417. | use pathnames for checking on a file's existence.                   |
  418. |                                          |
  419. |READER NOTE:The IF & IF EXIST cmnds are important to you. Review THIS|
  420. | file & IF.HLP,then s-t-u-d-y the "EXIST".BAT files.YOU'LL HAVE IT!  |
  421. |                                      |
  422. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  423. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  424. |command:MORE (with options)                                          |
  425. |use:MORE controls file screen output by limiting to 24 li. @ a time. |
  426. |how:Type: TYPE <file.ext> | MORE
  427. |         THE MORE COMMAND GOES IN A BATCH FILE AFTER THE             |
  428. |       NAME OF THE FILE (TYPE MY.DOC | MORE) [for example]           |
  429. |                                                                     |
  430. |  N-O-T-E:MORE is a DOS filter (like FIND and SORT). It can be used  |
  431. |  with the Type command or with other commands,where you want to view|
  432. |  24 lines or one screen at a time. To advance you hit any key (hitt-|
  433. |  ing the space bar or return will NOT leave a character.[Desireable |
  434. |  if you are using PrtSc]). See many of the Batch files on this Disk |
  435. |  to see some interesting applications of MORE when combined with the|
  436. |  other DOS filters in batch processing files. Many keystrokes and   |
  437. |  much time can be saved this way!                                   |
  438. |---------------T  I   M   E   M   A   S   T   E   R------------------|
  439. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  440. |commandS:Various PARAMETERS used in commands, including batch cmds.  |
  441. |use:To modify or otherwise change the effect of the command.         |
  442. |                                                                     |
  443. |how:Type <command> <parameter> or use parameters in batch files.     |
  444. |                                                                     |
  445. |examples:There are many batch files on this disk you can study to    |
  446. | see how Parameters work. Also see examples included below.          |
  447. |                                                                     |
  448. |explanation:Parameters are extra pieces of information that you type |
  449. | after many DOS cmnds.or in batch file instructions.DIR B:/W,for ex- |
  450. | ample, illustrates modification of the DOS command DIR. By adding   |
  451. | the parameters B: and /W you are modifying basic operation of the   |
  452. | command. You pass parameters to batch files the same way--by typing |
  453. | the information after the batch command, but BEFORE typing the      |
  454. | balance of the information. This process is called "testing". This  |
  455. | will seem complicated at first, but once you get the hang of it you |
  456. | will wonder why you didn't know about batch processing (replaceable)|
  457. | parameters before. Parameters may be used any place in a batch file |
  458. | they are needed to "test" for the presence of something you typed,  |
  459. | (or DIDN'T TYPE) at the prompt (it WILL get clearer!).              |
  460. | The secret to understanding batch file parameters is to slowly work |
  461. | into the subject. The batch processing file uses parameters in sev- |
  462. | eral ways as it is being run and this (at first) makes comprehension|
  463. | difficult. "Markers" are used within the batch file as "signals" as |
  464. | to wh/parameter goes where. Markers are comprised of a percent sign |
  465. | (%) and a single digit between 0 and 9 (that's ten markers in use   |
  466. | at any one time--remember that zero is a number). The %0 is ALWAYS  |
  467. | the NAME OF THE BATCH PROCESSING FILE! As if it wasn't confusing    |
  468. | enough already, many manuals refer to markers as simply "variables".|
  469. | The name, obviously, is not as important as the concept. To cover   |
  470. | this, however, we also have a file called:VAR.HLP. It covers the    |
  471. | fact that THERE IS a difference between parameters and variables.   |
  472. |                                                                     |
  473. | examples: Assume that a batch file named COLORGO.BAT is on the cur- |
  474. | rent drive. This file contains ONLY a  single command:              |
  475. |       ECHO %0 %1 %2 %3  [ECHO shows messages on the screen].        |
  476. | If, at the DOS prompt, you typed: COLORGO Red Blue Green THAT cmd.  |
  477. | would recognize that FOUR parameters were passed to the batch file. |
  478. | The batch file via the ECHO would display them on the screen in the |
  479. | order received (0=colorgo{name of .BAT file}; %1=red; %2=blue & %3= |
  480. | green) in the form you typed in. The parameters and markers were    |
  481. | related,(to restate),as follows... ECHO COLORGO Red Blue Green      |
  482. |                                            %0    %1  %2    %3       |
  483. |          TO EXPLAIN REPLACEABLE PARAMETERS ANOTHER WAY:             |
  484. | You can include dummy parameters within your batch file which DOS   |
  485. | will replace with values you supply on the command line when exe-   |
  486. | cuting the file. Using replaceable parameters allows you to specify |
  487. | DIFFERENT sets of data every time you run the batch file. You can   |
  488. | use up to 10 parameters; if more are needed, the shift command (SEE |
  489. | SHIFT.HLP)can be used to extend the available set. Note that OTHER  |
  490. | areas in the batch file can recognize the %X parameters as well.For |
  491. | example, you might want a message: ECHO ...WORK COMPLETE ON %1      |
  492. | the batch file would repeat the message but replace %1 with the name|
  493. | you typed on the command or prompt line. Examine the .BAT files on  |
  494. | this disk to see many examples of how this is accomplished.         |
  495. | Another example of replaceable parameters is shown below:           |
  496. |                                      |
  497. |                      FINDIT B: ROUND BLUE                           |
  498. |                                      |
  499. | When you type in a command, the command itself (FINDIT) is para-    |
  500. | meter %0. The parameter following the COMMAND (B:) is %1, and so on.|
  501. | In the example, therefore, ROUND=%1 and BLUE=%2 (a % for each word) |
  502. | All parameters following the cmd.take on succesive parameter values.|
  503. |                                      |
  504. | Here is another way to illustrate parameters (the loop file):       |
  505. |                          LOOP MYDEMO.DOC                            |
  506. |             REM - LOOP BATCH FILE FOR %1                            |
  507. |             TYPE %1                                                 |
  508. |             .                                                       |
  509. |             .           (MYDEMO.DOC {%!} is displayed)              |
  510. |             .                                                       |
  511. |             CLS                                                     |
  512. |             LOOP                                                    |
  513. |             REM - LOOP BATCH FILE FOR %1                            |
  514. |             .                                                       |
  515. |             . (FILE IS DISPLAYED again)                             |
  516. |             .                                                       |
  517. |             FILE WILL KEEP GOING UNTIL YOU CTRL C OR CTRL-BREAK     |
  518. |                                                                     |
  519. | While not particularly useful,this batch file serves to demonstrate |
  520. | replaceable parameters. There are a few ways in which such a file   |
  521. | (looping batch file) like the one above could be used. It could     |
  522. | continuously run a software demonstration package or graphics       |
  523. | animation program with a loop. You could also test the integrity of |
  524. | hardware by running a continuous test program over and over until   |
  525. | you stopped it.                              |
  526. |                                              |
  527. | Here's an experiment with replaceable parameters you can try:       |
  528. |                      (Create the following file)                    |
  529. |               COPY CON:SEEFILE.BAT                                  |
  530. |               TYPE %1                                               |
  531. |               TYPE %2                                               |
  532. |               TYPE %3                                               |
  533. |               <F6> <RETURN>                                         |
  534. | This batch file will display,using TYPE,the files that you specify  |
  535. | as the first,second, and third parameters on the command line. Each |
  536. | filename.ext type would be typed in the order requested, on the CRT.|
  537. | screen. You could also use *.* (wildcards) as %1 and it would dis-  |
  538. | play a whole group of files ( or *.DOC to display THOSE files). You |
  539. | could also use *.DOC as %1; *.TXT as %2, etc. When you use MULTIPLE |
  540. | PARAMETERS in a batch file they MUST be separated by spaces. To ill-|
  541. | ustrate:Often you have repetitive tasks which are quite similar,per-|
  542. | haps differing only by the file being processed. A parameter is used|
  543. | to provide a file name to the .BAT file. This way, a batch file can |
  544. | immediately perform a task for you without having to be specially   |
  545. | edited to match your current needs. For example, INFORM.BAT :       |
  546. |                                                                     |
  547. | On monday:                                                          |
  548. |   INFORM THUR.DAT FRI.DAT SAT.DAT SUN.DAT                           |
  549. | On thursday:                                 |
  550. |   INFORM MON.DAT TUE.DAT WED.DAT                                    |
  551. | Up to 10 parameters may be used. Our example, INFORM.BAT would have |
  552. | a command line in its body. It could be COPY %1 + %2 + %3 + %4=A:RE-|
  553. | PORT (which would copy the files into ONE called REPORT which could |
  554. | then be renamed whatever you wanted). Or you could give a PRINT cmd.|
  555. | such as: PRINT %1 %2 %3 %4. There is no limit to your instructions. |
  556. |           REVIEW THE .BAT FILES ON THIS DISK WITH PARAMETERS        |
  557. |                                      |
  558. | There may be times when you want to create an application program   |
  559. | and run it with different sets of data. This data may be stored     |
  560. | in various DOS files. Let's illustrate this & then examine our work.|
  561. | For example, when you type the command line COPY CON DOFILE.BAT,    |
  562. | the next lines you type are copied from the console to a file named |
  563. | DOFILE.BAT on the default drive:                                    |
  564. |                     COPY CON DOFILE.BAT                             |
  565. |                     COPY %1.INF+%2.INF=%2.PRN                       |
  566. |                     TYPE %2.PRN                                     |
  567. |                     PRINT %2.PRN                         |
  568. | Now press <F6> or <ctrl/z> and then press <return>. DOS responds:   |
  569. |                    "1 file(s) copied"                               |
  570. | The file DOFILE.BAT, which consists of three commands, now resides  |
  571. | on the disk in the default drive. It stands ready for variables!    |
  572. | The dummy parameters %1 and %2 are replaced sequentially by the     |
  573. | parameters you supply when you execute the file. The dummy parameter|
  574. | %0 is always replaced by the drive designator, if specified, and    |
  575. | the filename of the batch file (for example:DOFILE).Now let's do it!|
  576. | To execute the batch file DOFILE.BAT and to specify the parameters  |
  577. | that will replace the dummy param.(markers),you must type the batch |
  578. | file name(without its extension) followed by the parameters you     |
  579. | want DOS to substitute for %1, %2, etc. Let's look at what happens: |
  580. |                                                                     |
  581. |       (Remember that the file DOFILE.BAT consists of 3 lines):      |
  582. |                       COPY %1.INF+%2.INF=%2.PRN
  583. |                       TYPE %2.PRN                                   |
  584. |                       PRINT %2.PRN                                  |
  585. | To execute the batch processing file, DOFILE you might type:        |
  586. |                        DOFILE A:DATA1 B:DATA2                       |
  587. | DOFILE is substituted for %0, A:DATA1 for %1, and B:DATA2 for %2.   |
  588. |             (notice how the drives can be inserted)                 |
  589. | The result is the same as if you had typed each of the commands in  |
  590. | DOFILE with their parameters, as follows:                           |
  591. | COPY A:DATA1.INF+B:DATA2.INF=DATA2.PRN [COPY DATA1&DATA2=DATA2.PRN] |
  592. | TYPE B:DATA2.PRN    [DISPLAYING THE COMBINED FILE]                  |
  593. | PRINT B:DATA2.PRN   [PRINT THE COMBINED FILE]                       |
  594. | The following illustrates how DOS replaces each of the parameters:  |
  595. | BATCH    PARAMETER1  (%0)  PARAMETER2  (%1)   PARAMETER3  (%2)      |
  596. | FILENAME  (DOFILE)          (DATA1)             (DATA2)             |
  597. | DOFILE    DOFILE.BAT        DATA1.INF           DATA2.INF           |
  598. |                                                 DATA2.PRN           |
  599. |                                                                     |
  600. |                            NOTES                                    |
  601. | 1. Up to 10 dummy parameters (%0-%9) can be specified. Refer to the |
  602. | DOS command SHIFT if you wish to specify more than 10 parameters.   |
  603. | 2. If you use the percent sign as part of a FILE NAME within a      |
  604. | batch file, you must type it twice. For example, to specify the file|
  605. | XYZ%.BAT, you must type it as XYZ%%.BAT in the batch file.          |
  606. |                                                                     |
  607. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  608. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  609. |command: PAUSE                                                       |
  610. |use: To pass to a user control of a batch file while processing.     |
  611. |                                                                     |
  612. |how:Type:(in a batch file)  PAUSE <Message, if any>                  |
  613. |                                                                     |
  614. |example:Virtually every >BAT file on this disk has a PAUSE command.  |
  615. | TIMEMASTER displays messages on a separate line so we can insert    |
  616. | different colors for the message and the PAUSE instruction in the   |
  617. | color versions of these files.                                      |
  618. |                                      |
  619. |NOTES: The basic function of PAUSE is to stop the execution of the   |
  620. | batch file until you press a key. This can allow you to perform     |
  621. | a necessary task -- like perhaps changing a disk or verifying that  |
  622. | a particular disk configuration is in place, in order to avoid      |
  623. | errors as the remaining parts of the batch file are executed.       |
  624. | Pause will optionally display a message.                            |
  625. |  The message will show, followed by the DOS message:                |
  626. |                  Strike any key when ready...                       |
  627. |         THE PAUSE SUBCOMMAND IN BATCH PROCESSING FILES...           |
  628. | The PAUSE subcommand suspends execution of the batch file temporar- |
  629. | ily and displays the message "Strike any key when ready..." You     |
  630. | can display messages in a batch file with the ECHO subcommand and   |
  631. | then pause so the reader can read the message. These messages       |
  632. | must precede the PAUSE command. A common method used in batch files |
  633. | is to display a message before a major command is issued, thus giv- |
  634. | ing the user a chance to break out of the batch file. Example:      |
  635. |                 ECHO DRIVE C IS ABOUT TO BE ERASED...               |
  636. |                 ECHO Press Ctrl-Break to stop or                    |
  637. |                 PAUSE                                               |
  638. | The screen display would appear as follows:                         |
  639. |               DRIVE C IS ABOUT TO BE ERASED...                      |
  640. |               Press Ctrl-Break to stop or  [also Ctrl C]            |
  641. |               Strike any key when ready...                          |
  642. | One of the most useful features of PAUSE is to allow a user to      |
  643. | change diskettes between commands of a batch file.                  |
  644. | You can use the PAUSE command to segment a batch file into segments |
  645. | that can be stopped at any appropriate point. <comment> is optional |
  646. | and should be entered on the same line as PAUSE. <comment> is used  |
  647. | to prompt -- with a meaningful message -- the batch file user to    |
  648. | take some action when the file pauses. The <comment> is displayed   |
  649. | before the "Strike any key when ready..." message.                  |
  650. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  651. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  652. |command: REMark                                                      |
  653. |use: The REM command displays on the CRT screen any text that is on  |
  654. | the same line as the REM cmd.when a batch processing file is running|
  655. |how:Type:(in a batch processing file) REM <comment or message>       |
  656. |actual batch file: REM This file checks new disks                    |
  657. |                   REM It is named MAKEDISK.BAT                      |
  658. |                   PAUSE Insert new disk in drive B:                 |
  659. |                   FORMAT B:/S                                       |
  660. |                   CHKDSK B:                                         |
  661. |NOTES: REMark can be used to send messages to the screen or simply   |
  662. | to document some part of your batch file's operation. REM won't work|
  663. | with ECHO! We prefer REM ONLY for short files. The computer opera-  |
  664. | tor(it won't always be you)will want to know what is happening.Also,|
  665. | after some time,you may forget what a complicated set of commands   |
  666. | actually does. REM messages can be up to 123 characters long,but DO |
  667. | keep the width of the screen in mind. This way you can control the  |
  668. | display and make it even more meaningful. CENTER remarks when you   |
  669. | can. ALL of the foregoing of course also applies to ECHO messages.  |
  670. | If a line in a batch file starts with one or more periods (.) it is |
  671. | treated as a remark (in DOS 2.xx, DOS 3.x won't allow this). THUS   |
  672. | REM This is a test  a-n-d  . This is a test are treated equally.    |
  673. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  674. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  675. |command: SHIFT                                                       |
  676. |use: The SHIFT command lets your batch file access more than 10      |
  677. | replaceable parameters.                                             |
  678. |                                      |
  679. |example:The SHIFT command is illustrated by this example:            |
  680. |     [the lines below are as they would appear in a batch file]      |
  681. |     If %0 = "bak"                                                   |
  682. |     %1 = "mine"                                                     |
  683. |     %2 = "yours"                                                    |
  684. |     %3...%9 are empty                                               |
  685. |     then a SHIFT (command) results in the following:                |
  686. |     %0 = "bak"                                                      |
  687. |     %1 = "yours"                                                    |
  688. |     %2...%9 are empty  ["mine" has been "shifted" out]              |
  689. | If you are still confused review the PARAM.HLP file.                |
  690. |                                                                     |
  691. |NOTES:DOS allows 10 parameters (%0-%9) to be used by a batch file.   |
  692. | SHIFT allows you to move more parameters into a queue, discarding   |
  693. | the first parameter. When you are listing parameters at the prompt, |
  694. | additional parameters (more than 10) should be on the same command  |
  695. | line in order to be shifted into the queue.The single cmd.is SHIFT. |
  696. | When that subcommand is encountered, all parameter/marker pairings  |
  697. | are shifted one to the left. Whatever was assigned to %0 is lost,   |
  698. | the contents of %1 are moved to %0, %2 moves to %1... %9 moves to   |
  699. | %8 and a new parameter from the command line is moved into %9.      |
  700. | While this brings in a new parameter, all have shifted and you must |
  701. | anticipate the effect on your batch file "program".                 |
  702. | The effect of SHIFT:                                                |
  703. |  %0   %1   %2   %3   %4   %5   %6   %7   %8   %9                    |
  704. |  |      Remember, this command seems very simple, but its effects   |
  705. |  |      are far ranging and the logical consequence of mis-matching |
  706. |  |      parameters and markers can be disastrous!                   |
  707. |  |                                                                  |
  708. | Lost                                                                |
  709. |                                                                     |
  710. |                 MORE ABOUT THE SHIFT SUBCOMMAND:                    |
  711. | The SHIFT subcommand is made to be used with replaceable parameters.|
  712. | In the PARAM.HLP file there is an example for you to create called  |
  713. | SEEFILE.BAT which shows you how to display three files you call up. |
  714. | What if you wanted to display four files? You would have to rewrite |
  715. | the batch file to include another TYPE command, or you could use    |
  716. | the SHIFT command for more than 10 parameters in a file. The        |
  717. | following batch file uses the GOTO and SHIFT command to ECHO any    |
  718. | number of parameters typed on the command line.                     |
  719. |                    (you should create this file)                    |
  720. |       COPY CON:REVEAL.BAT                                           |
  721. |       ECHO OFF                                                      |
  722. |       CLS                                  |
  723. |       :LOOP                                                         |
  724. |       CLS                                                           |
  725. |       TYPE %1 | MORE                                                |
  726. |       SHIFT                                                         |
  727. |       GOTO LOOP                                                     |
  728. |       <F6> or <Ctrl Z> <Return>                                     |
  729. | To execute type: REVEAL <FILENAME.EXT> <FILENAME.EXT>,ETC.,ETC.     |
  730. |                                      |
  731. | CAUTION:When this file runs out of parameters you will get a message|
  732. | "invalid number of parameters". It will then KEEP REPEATING until   |
  733. | YOU STOP IT with a Ctrl C or Ctrl-Break! The file can only "read"   |
  734. | the number of parameters you put on the prompt or command line.     |
  735. | NOTE: the MORE command is to assure that if a text file (that is    |
  736. | the only kind you can display with TYPE) is more than 24 lines, a   |
  737. | pause will be inserted. Wildcards cannot be used with the command.  |
  738. |                                      |
  739. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  740. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  741. |command:SORT (with options)                                          |
  742. |use:SORT puts lines from a specified file into a particular order.   |
  743. |how:Type: "SORT < file.ext" = Sorted file will be displayed on scrn. |
  744. |          "SORT /R <file.ext"=REVERSE sorted file to screen.         |
  745. |          "SORT+n < file.ext"=Sort by character in col.n(number).*   |
  746. |          "SORT < file.ext > sortedfile.ext=Sorts file.ext,then puts |
  747. |              data in sortedfile.ext.                                |
  748. |          "SORT < file.ext >> sortedfile.ext=Sorts file.ext, then    |
  749. |              APPENDS sorted data to EXISTING sortedfile.ext.        |
  750. |          "SORT < CON > file.ext=Sorts as you type data on keyboard, |
  751. |              then places sorted data into file.ext.                 |
  752. |          "SORT /R+n < file.ext"=Sort in reverse by col.n.*          |
  753. |      ANY OF THE ABOVE COMMANDS CAN BE INSERTED IN A BATCH FILE      |
  754. |                                          |
  755. |  N-O-T-E:Since SORT is a filter it gets its data via redirection < .|
  756. |  *column n=1-80 [look at the ASCII text, count from the left].Sort  |
  757. |  is by ASCII preference [#$%&'()*+0 1-9 :;<=>?@ A-Z [\]^ a-z{|},etc]|
  758. |  Tips:DIR|SORT > PRN [prints DIR] & DIR|SORT > DIRECT.LST [stores   |
  759. |  in a file of your choice].                                         |
  760. |---------------T  I   M   E   M   A   S   T   E   R------------------|
  761. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  762. |command: CTRL C (MS-DOS)  or CTRL-BREAK or  SCR LOCK (PC-DOS)        |
  763. |                                      |
  764. |use: To stop a batch file from being processed.                      |
  765. |                                                                     |
  766. |how:Type:CTRL C as batch file is running and it will stop for your   |
  767. | Yes or No confirmation as to discontinuance.                        |
  768. |                                                                     |
  769. |NOTES:When you stop a batch file,the message is:Abort batch job?(Y/N)|
  770. | If you press N for No the task the batch file is performing goes on.|
  771. |                                                                     |
  772. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  773. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  774. |command:%<name>% (within a batch processing file)                    |
  775. |                                          |
  776. |use:A way of passing specific data to a batch processing file.       |
  777. |                                                                     |
  778. |how:Type: %<name>% to set the variable.                              |
  779. |                                                                     |
  780. |NOTES:Variables provide another way of passing specific data to a    |
  781. | batch processing file. Please make THIS distinction, there IS an    |
  782. | important difference between variables and parameters. PARAMETERS   |
  783. | are constantly changing.A variable,once declared,RETAINS its value  |
  784. | until either you reset it or turn the PC off. Using the variable    |
  785. | you can not only pass values to the system but to other .BAT files. |
  786. | A variable is a text string(a name)enclosed by % signs (%variable%) |
  787. | Values are given to variables with the DOS SET command. For example,|
  788. | if a batch file contains the statement: LINK %FILE% you can "set"   |
  789. | %FILE% to ANOTHER name (which DOS will then recognize, having dis-  |
  790. | carded FILE and replacing it with the new name). In the example,and |
  791. | to replace %FILE% you would type: SET FILE = DOFILE (DOFILE now is  |
  792. | the variable).                                 |
  793. |                                      |
  794. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  795. END  END  END  END  END  END  END  END  END  END  END  END  END  END  END
  796. |                                                 DATA2.PRN           |
  797. |                                                                     |
  798. |                            NOTES                                    |
  799. | 1. Up to 10 dummy parameters (%0-%9) can be specified. Refer to the |
  800. | DOS command SHIFT if you wish to specify more than 10 parameters.   |
  801. | 2. If you use the percent sign as part of a FILE NAME within a      |
  802. | batch file, you must type it twice. For example, to specify the file|
  803. | XYZ%.BAT, you must type it as XYZ%%.BAT in the batch file.          |
  804. |                                                                     |
  805. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  806.                 #
  807.                 #
  808.                 #
  809. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  810. |command: PAUSE                                                       |
  811. |use: To pass to a user control of a batch file while processing.     |
  812. |                                                                     |
  813. |how:Type:(in a batch file)  PAUSE <Message, if any>                  |
  814. |                                                                     |
  815. |example:Virtually every >BAT file on this disk has a PAUSE command.  |
  816. | TIMEMASTER displays messages on a separate line so we can insert    |
  817. | different colors for the message and the PAUSE instruction in the   |
  818. | color versions of these files.                                      |
  819. |                                      |
  820. |NOTES: The basic function of PAUSE is to stop the execution of the   |
  821. | batch file until you press a key. This can allow you to perform     |
  822. | a necessary task -- like perhaps changing a disk or verifying that  |
  823. | a particular disk configuration is in place, in order to avoid      |
  824. | errors as the remaining parts of the batch file are executed.       |
  825. | Pause will optionally display a message.                            |
  826. |  The message will show, followed by the DOS message:                |
  827. |                  Strike any key when ready...                       |
  828. |         THE PAUSE SUBCOMMAND IN BATCH PROCESSING FILES...           |
  829. | The PAUSE subcommand suspends execution of the batch file temporar- |
  830. | ily and displays the message "Strike any key when ready..." You     |
  831. | can display messages in a batch file with the ECHO subcommand and   |
  832. | then pause so the reader can read the message. These messages       |
  833. | must precede the PAUSE command. A common method used in batch files |
  834. | is to display a message before a major command is issued, thus giv- |
  835. | ing the user a chance to break out of the batch file. Example:      |
  836. |                 ECHO DRIVE C IS ABOUT TO BE ERASED...               |
  837. |                 ECHO Press Ctrl-Break to stop or                    |
  838. |                 PAUSE                                               |
  839. | The screen display would appear as follows:                         |
  840. |               DRIVE C IS ABOUT TO BE ERASED...                      |
  841. |               Press Ctrl-Break to stop or  [also Ctrl C]            |
  842. |               Strike any key when ready...                          |
  843. | One of the most useful features of PAUSE is to allow a user to      |
  844. | change diskettes between commands of a batch file.                  |
  845. | You can use the PAUSE command to segment a batch file into segments |
  846. | that can be stopped at any appropriate point. <comment> is optional |
  847. | and should be entered on the same line as PAUSE. <comment> is used  |
  848. | to prompt -- with a meaningful message -- the batch file user to    |
  849. | take some action when the file pauses. The <comment> is displayed   |
  850. | before the "Strike any key when ready..." message.                  |
  851. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  852. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  853. |command: REMark                                                      |
  854. |use: The REM command displays on the CRT screen any text that is on  |
  855. | the same line as the REM cmd.when a batch processing file is running|
  856. |how:Type:(in a batch processing file) REM <comment or message>       |
  857. |actual batch file: REM This file checks new disks                    |
  858. |                   REM It is named MAKEDISK.BAT                      |
  859. |                   PAUSE Insert new disk in drive B:                 |
  860. |                   FORMAT B:/S                                       |
  861. |                   CHKDSK B:                                         |
  862. |NOTES: REMark can be used to send messages to the screen or simply   |
  863. | to document some part of your batch file's operation. REM won't work|
  864. | with ECHO! We prefer REM ONLY for short files. The computer opera-  |
  865. | tor(it won't always be you)will want to know what is happening.Also,|
  866. | after some time,you may forget what a complicated set of commands   |
  867. | actually does. REM messages can be up to 123 characters long,but DO |
  868. | keep the width of the screen in mind. This way you can control the  |
  869. | display and make it even more meaningful. CENTER remarks when you   |
  870. | can. ALL of the foregoing of course also applies to ECHO messages.  |
  871. | If a line in a batch file starts with one or more periods (.) it is |
  872. | treated as a remark (in DOS 2.xx, DOS 3.x won't allow this). THUS   |
  873. | REM This is a test  a-n-d  . This is a test are treated equally.    |
  874. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  875. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  876. |command: SHIFT                                                       |
  877. |use: The SHIFT command lets your batch file access more than 10      |
  878. | replaceable parameters.                                             |
  879. |                                      |
  880. |example:The SHIFT command is illustrated by this example:            |
  881. |     [the lines below are as they would appear in a batch file]      |
  882. |     If %0 = "bak"                                                   |
  883. |     %1 = "mine"                                                     |
  884. |     %2 = "yours"                                                    |
  885. |     %3...%9 are empty                                               |
  886. |     then a SHIFT (command) results in the following:                |
  887. |     %0 = "bak"                                                      |
  888. |     %1 = "yours"                                                    |
  889. |     %2...%9 are empty  ["mine" has been "shifted" out]              |
  890. | If you are still confused review the PARAM.HLP file.                |
  891. |                                                                     |
  892. |NOTES:DOS allows 10 parameters (%0-%9) to be used by a batch file.   |
  893. | SHIFT allows you to move more parameters into a queue, discarding   |
  894. | the first parameter. When you are listing parameters at the prompt, |
  895. | additional parameters (more than 10) should be on the same command  |
  896. | line in order to be shifted into the queue.The single cmd.is SHIFT. |
  897. | When that subcommand is encountered, all parameter/marker pairings  |
  898. | are shifted one to the left. Whatever was assigned to %0 is lost,   |
  899. | the contents of %1 are moved to %0, %2 moves to %1... %9 moves to   |
  900. | %8 and a new parameter from the command line is moved into %9.      |
  901. | While this brings in a new parameter, all have shifted and you must |
  902. | anticipate the effect on your batch file "program".                 |
  903. | The effect of SHIFT:                                                |
  904. |  %0   %1   %2   %3   %4   %5   %6   %7   %8   %9                    |
  905. |  |      Remember, this command seems very simple, but its effects   |
  906. |  |      are far ranging and the logical consequence of mis-matching |
  907. |  |      parameters and markers can be disastrous!                   |
  908. |  |                                                                  |
  909. | Lost                                                                |
  910. |                                                                     |
  911. |                 MORE ABOUT THE SHIFT SUBCOMMAND:                    |
  912. | The SHIFT subcommand is made to be used with replaceable parameters.|
  913. | In the PARAM.HLP file there is an example for you to create called  |
  914. | SEEFILE.BAT which shows you how to display three files you call up. |
  915. | What if you wanted to display four files? You would have to rewrite |
  916. | the batch file to include another TYPE command, or you could use    |
  917. | the SHIFT command for more than 10 parameters in a file. The        |
  918. | following batch file uses the GOTO and SHIFT command to ECHO any    |
  919. | number of parameters typed on the command line.                     |
  920. |                    (you should create this file)                    |
  921. |       COPY CON:REVEAL.BAT                                           |
  922. |       ECHO OFF                                                      |
  923. |       CLS                                  |
  924. |       :LOOP                                                         |
  925. |       CLS                                                           |
  926. |       TYPE %1 | MORE                                                |
  927. |       SHIFT                                                         |
  928. |       GOTO LOOP                                                     |
  929. |       <F6> or <Ctrl Z> <Return>                                     |
  930. | To execute type: REVEAL <FILENAME.EXT> <FILENAME.EXT>,ETC.,ETC.     |
  931. |                                      |
  932. | CAUTION:When this file runs out of parameters you will get a message|
  933. | "invalid number of parameters". It will then KEEP REPEATING until   |
  934. | YOU STOP IT with a Ctrl C or Ctrl-Break! The file can only "read"   |
  935. | the number of parameters you put on the prompt or command line.     |
  936. | NOTE: the MORE command is to assure that if a text file (that is    |
  937. | the only kind you can display with TYPE) is more than 24 lines, a   |
  938. | pause will be inserted. Wildcards cannot be used with the command.  |
  939. |                                      |
  940. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  941. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  942. |command:SORT (with options)                                          |
  943. |use:SORT puts lines from a specified file into a particular order.   |
  944. |how:Type: "SORT < file.ext" = Sorted file will be displayed on scrn. |
  945. |          "SORT /R <file.ext"=REVERSE sorted file to screen.         |
  946. |          "SORT+n < file.ext"=Sort by character in col.n(number).*   |
  947. |          "SORT < file.ext > sortedfile.ext=Sorts file.ext,then puts |
  948. |              data in sortedfile.ext.                                |
  949. |          "SORT < file.ext >> sortedfile.ext=Sorts file.ext, then    |
  950. |              APPENDS sorted data to EXISTING sortedfile.ext.        |
  951. |          "SORT < CON > file.ext=Sorts as you type data on keyboard, |
  952. |              then places sorted data into file.ext.                 |
  953. |          "SORT /R+n < file.ext"=Sort in reverse by col.n.*          |
  954. |      ANY OF THE ABOVE COMMANDS CAN BE INSERTED IN A BATCH FILE      |
  955. |                                          |
  956. |  N-O-T-E:Since SORT is a filter it gets its data via redirection < .|
  957. |  *column n=1-80 [look at the ASCII text, count from the left].Sort  |
  958. |  is by ASCII preference [#$%&'()*+0 1-9 :;<=>?@ A-Z [\]^ a-z{|},etc]|
  959. |  Tips:DIR|SORT > PRN [prints DIR] & DIR|SORT > DIRECT.LST [stores   |
  960. |  in a file of your choice].                                         |
  961. |---------------T  I   M   E   M   A   S   T   E   R------------------|
  962.                 #
  963.                 #
  964.                 #
  965.                 #
  966.                 #
  967.                 #
  968. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  969. |command: CTRL C (MS-DOS)  or CTRL-BREAK or  SCR LOCK (PC-DOS)        |
  970. |                                      |
  971. |use: To stop a batch file from being processed.                      |
  972. |                                                                     |
  973. |how:Type:CTRL C as batch file is running and it will stop for your   |
  974. | Yes or No confirmation as to discontinuance.                        |
  975. |                                                                     |
  976. |NOTES:When you stop a batch file,the message is:Abort batch job?(Y/N)|
  977. | If you press N for No the task the batch file is performing goes on.|
  978. |                                                                     |
  979. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  980.                 #
  981. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  982. |command:%<name>% (within a batch processing file)                    |
  983. |                                          |
  984. |use:A way of passing specific data to a batch processing file.       |
  985. |                                                                     |
  986. |how:Type: %<name>% to set the variable.                              |
  987. |                                                                     |
  988. |NOTES:Variables provide another way of passing specific data to a    |
  989. | batch processing file. Please make THIS distinction, there IS an    |
  990. | important difference between variables and parameters. PARAMETERS   |
  991. | are constantly changing.A variable,once declared,RETAINS its value  |
  992. | until either you reset it or turn the PC off. Using the variable    |
  993. | you can not only pass values to the system but to other .BAT files. |
  994. | A variable is a text string(a name)enclosed by % signs (%variable%) |
  995. | Values are given to variables with the DOS SET command. For example,|
  996. | if a batch file contains the statement: LINK %FILE% you can "set"   |
  997. | %FILE% to ANOTHER name (which DOS will then recognize, having dis-  |
  998. | carded FILE and replacing it with the new name). In the example,and |
  999. | to replace %FILE% you would type: SET FILE = DOFILE (DOFILE now is  |
  1000. | the variable).                                 |
  1001. |                                      |
  1002. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  1003.